package com.hopes.bizz.risk.statistic.controller;

import com.hopes.bizz.risk.statistic.serivce.OperationStatisticService;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yumr
 * @Description 机制运行情况统计
 * @time 2023/8/1 13:44
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/statistic" )
@Tag(description = "statistic" , name = "机制运行情况" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class OperationStatisticController {


    private final OperationStatisticService operationStatisticService;

    /**
     * 最新机制运行评估信息
     */
    @Operation(summary = "最新机制运行评估信息" , description = "最新机制运行评估信息" )
    @GetMapping("/operationEvaluation" )
    public R getOperationEvaluation() {
        return R.ok(operationStatisticService.getOperationEvaluation());
    }

    /**
     * 统计风险对象，单元，事件，措施个数
     */
    @Operation(summary = "统计风险对象，单元，事件，措施个数" , description = "统计风险对象，单元，事件，措施个数" )
    @GetMapping("/riskCount" )
    public R getRiskCount() {
        return R.ok(operationStatisticService.getRiskCount());
    }

    /**
     * 风险对象管控统计
     */
    @Operation(summary = "风险对象管控统计" , description = "风险对象管控统计" )
    @GetMapping("/riskObject" )
    public R getRiskObject() {
        return R.ok(operationStatisticService.listRiskObjectStatisticVO());
    }

    /**
     * 风险单元统计
     */
    @Operation(summary = "风险单元统计" , description = "风险单元统计" )
    @GetMapping(value = "/unitClassify")
    public R riskUnitClassify() {
        return R.ok(operationStatisticService.riskUnitClassify());
    }

    /**
     * 风险辨识管控
     */
    @Operation(summary = "风险辨识管控" , description = "风险辨识管控" )
    @GetMapping(value = "/riskIdentify")
    public R riskIdentify() {
        return R.ok(operationStatisticService.riskIdentify());
    }

    /**
     * 隐患排查任务统计-排查结果(符合、不符合)
     * @param year  年份
     */
    @Operation(summary = "隐患排查任务统计-排查结果(符合、不符合)" , description = "隐患排查任务统计-排查结果(符合、不符合)")
    @GetMapping(value = "/hiddenCheckResult/{year}")
    public R hiddenCheckResult(@PathVariable Integer year) {
        return R.ok(operationStatisticService.hiddenCheckResult(year));
    }


    /**
     * 隐患排查任务统计-任务状态(未完成、已完成、已过期)
     * @param year  年份
     */
    @Operation(summary = "隐患排查任务统计-任务状态(未完成、已完成、已过期)" , description = "隐患排查任务统计-任务状态(未完成、已完成、已过期)")
    @GetMapping(value = "/hiddenCheckStatus/{year}")
    public R hiddenCheckStatus(@PathVariable Integer year) {
        return R.ok(operationStatisticService.hiddenCheckStatus(year));
    }



}
